package edu.neu.cs6515.xml.w12;

import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
@XmlRootElement(name="players")
public class PlayerNames {

    @Setter
    private List<PlayerName> names;
    
    @XmlElement(name = "player" )
    public List<PlayerName> getNames() {
        return names;
    }
    

    public static List<PlayerName> fromStringToPlayerNames(final List<String> strNames){
        List<PlayerName> playerNames= new LinkedList<PlayerName>();
        for (String string : strNames) {
            playerNames.add(new PlayerName(string));
        }
        return playerNames;
    }
    
    
    public List<String> toStrings(){
        List<String> playerNameStrings = new LinkedList<String>();
        for (PlayerName name : names) {
            playerNameStrings.add(name.getName());
        }
        return playerNameStrings;
    }
    
}
